@extends('default.layouts.adminPublic')
@section('title', '图片清理')

@section('content')
<!--导航开始-->
<div class="crumb_warp">
    <i class="fa fa-home"></i> <a href="{{url('admin')}}">首页</a> &raquo; 资讯管理
</div>
<!--导航结束-->

<!--列表开始-->

    <div class="result_wrap">
        <div class="result_title">
            <h3>待删除图片列表</h3>
            @include('flash::message')
        </div>
        <!--快捷导航 开始-->
        <div class="result_content">
            <div class="short_wrap">
                <i>共有：<em>[{{ $NewsImgExist->total() }}]</em>张冗余图片</i><a onclick="delNews()"><i class="fa fa-trash-o"></i>一键清除</a><em>{{ session('message') }}</em>
            </div>
        </div>
        <!--快捷导航 结束-->
    </div>

    <div class="result_wrap">
        <div class="result_content">
            <ul class="list_tab make">
                <li class="title border_buttom">
                    <span class="first">序号</span>
                    <span class="clearpic-second ">图片</span>
                </li>
                @foreach($NewsImgExist as $k => $v)
                    <li class="@if($k % 2 == 0) saith_bg @else double_bg @endif border_buttom">
                        <span class="first">{{ $k+1 }}</span>
                        <span class="clearpic-second"><img src="{{ asset($v->img_url ) }}" width="25" height="25"></span>
                    </li>
                @endforeach
            </ul>
        </div>
    </div>
<div class="page_list">
    <div>{!! $NewsImgExist->links() !!}</div>
</div>
<!--列表结束-->

<script>
    //删除资讯
    function delNews() {
        clearLayer = layer.confirm('现在要删除所有冗余的图片吗？', {

            btn: ['确定', '取消'], //按钮
            area:[ '200px','150px']
        }, function () {
            $.get("{{url('admin/news/toclearpic')}}/", {
                '_method': 'delete',
                '_token': "{{csrf_token()}}"
            }, function (data) {
                if (data.status == 0) {
                    location.href="{{ url('admin/news/clearpic') }}";
                } else {
                    location.href="{{ url('admin/news/clearpic') }}";
                }
            });
        });
    }
</script>
@endsection